package com.ug.system.controller;

import com.ug.common.constant.SecurityConstants;
import com.ug.common.response.ResponseMessage;
import com.ug.common.response.ResponseMessageFactory;
import com.ug.system.service.HotToDayService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: LY
 * @date: 2024/12/18 14:23
 * @description: 热点信息控制器
 */
@Tag(name = "HotToDayController", description = "热点信息")
@RestController
@RequestMapping("/hot")
@RequiredArgsConstructor
public class HotToDayController {

    private final HotToDayService hotToDayService;

    /**
     * 获取所有热点信息
     */
    @Operation(summary = "今日热点信息", security = { @SecurityRequirement(name = SecurityConstants.TOKEN_HEADER) })
    @GetMapping("/getHotToDayList")
    public ResponseMessage<Object> getHotToDayList() {
        return ResponseMessageFactory.getSuccessResponseMessage(hotToDayService.getHotToDayList());
    }

    /**
     * 获取指定热点信息
     * @param hotName 热点渠道名称
     */
    @Operation(summary = "今日热点信息", security = { @SecurityRequirement(name = SecurityConstants.TOKEN_HEADER) })
    @GetMapping("/getHotToDay")
    public ResponseMessage<Object> getHotToDay(@Parameter(description = "热点渠道名称") @RequestParam("hotName") String hotName) {
        return ResponseMessageFactory.getSuccessResponseMessage(hotToDayService.getHotToDay(hotName));
    }
}
